package com.catmiao.spark.rdd.io

import org.apache.spark.api.java.JavaSparkContext.fromSparkContext
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @title: Spark01_RDD_Dep
 * @projectName spark_study
 * @description: TODO
 * @author ChengMiao
 * @date 2024/2/28 23:20
 */
object Spark01_RDD_IO_Load {


  def main(args: Array[String]): Unit = {
    val sparkCon = new SparkConf().setMaster("local[*]").setAppName("rdd")

    val sparkContext = new SparkContext(sparkCon)

    val rdd = sparkContext.textFile("output4")
    println(rdd.collect().mkString(","))

    val rdd2 = sparkContext.objectFile[(String, Int)]("output5")
    println(rdd2.collect().mkString(","))

    val rdd3 = sparkContext.sequenceFile[String, Int]("output6")
    println(rdd3.collect().mkString(","))

    sparkContext.stop()
  }


}
